import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/index',
    name: 'inedx',
    component: ()=> import('../views/Index.vue'),
    children:[
        {
            path:'/index/home',
            name:'home',
            component:()=> import('../views/Index/Home.vue')
        },
        {
            path: '/index/order',
            name: 'order',
            component: () => import('../views/Index/Order.vue')
        },
        {
            path: '/index/mine',
            name: 'mine',
            component: () => import('../views/Index/Mine.vue')
        },
        {
            path: '/index/baobao',
            name: 'baobao',
            component: () => import('../views/Index/Baobao.vue')
        },
        {
            path: '/index',
            redirect: '/index/home'
        },
        //404路由
        {
            path: '*',
            component: () => import('../views/NotFound.vue')
        }
    ]
  },
    {
        path: '/',
        redirect: '/index'
    },
    //404路由
    {
        path: '*',
        component: () => import('../views/NotFound.vue')
    }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
